package cn.zhaoyuening.fanrpc.common.beans;

public class RpcServiceAddress {
    private String address;
    private Integer port;

    public String getAddress() {
        return address;
    }

    public RpcServiceAddress setAddress(String address) {
        this.address = address;
        return this;
    }

    public Integer getPort() {
        return port;
    }

    public RpcServiceAddress setPort(Integer port) {
        this.port = port;
        return this;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof RpcServiceAddress) {
            RpcServiceAddress address = (RpcServiceAddress) obj;
            try {
                if (this.address.equals(address.getAddress()) && this.port.equals(address.getPort())) {
                    return true;
                }

            } catch (NullPointerException e) {
                return false;
            }
        }
        return super.equals(obj);
    }

    @Override
    public int hashCode() {
        return address.hashCode()+port.hashCode();
    }
}
